package com.hpeu_01.day0122;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class ImgSocketClient {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("localhost",9999);
        InputStream is = new FileInputStream("D:\\Steam\\Steam\\steamapps\\workshop\\content\\431960\\1543753982\\preview.jpg");
        OutputStream outputStream = socket.getOutputStream();
        byte[] b = new byte[1024];
        int len = -1;
        while ((len =is.read(b)) != -1){
            outputStream.write(b,0,len);
        }
        outputStream.close();
        is.close();
        socket.close();
    }
}
